package mygame;

import com.jme3.app.SimpleApplication;
import com.jme3.asset.AssetManager;
import com.jme3.light.DirectionalLight;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.renderer.RenderManager;
import com.jme3.scene.Geometry;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import com.jme3.scene.shape.Box;
import init.Initializer;
import pieces.Loader;
import pieces.Piece;

/**
 * 
 * @author david
 */
public class Main extends SimpleApplication {

    public static void main(String[] args) {
        
        Main app = new Main();
        app.start();
    }

    @Override
    public void simpleInitApp() {

        //Spatial chessboardSpatial = Loader.loadChessboard(assetManager, rootNode);

        Loader.loadChessboard(assetManager, rootNode);
        
        Vector3f[][] positions = Initializer.initializeMatrixPositions();
        
        Piece[] whitePieces = Loader.loadWhitePieces(assetManager, rootNode),
                blackPieces = Loader.loadBlackPieces(assetManager, rootNode);
        
        Initializer.initializePiecesPositions(whitePieces, blackPieces, positions);
        
        
        //Spatial bb = assetManager.loadModel("Models/white_queen.j3o");
        //bb.setLocalTranslation(positions[0][3]);
        //bb.scale(0.3f);
        //rootNode.attachChild(bb);
        //You must add a light to make the model visible
        DirectionalLight sun = new DirectionalLight();
        sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f));
        rootNode.addLight(sun);
    }

    @Override
    public void simpleUpdate(float tpf) {
        //TODO: add update code
    }

    @Override
    public void simpleRender(RenderManager rm) {
        //TODO: add render code
    }
}
